<!--
 * @FilePath     : /jquery/demo/101-18.html
 * @Description  : :nth-of-type
 * @Date         : 2025-03-27 13:44:40
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-03-27 13:48:04
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <h2>jq_page</h2>

    <div>
      <span>John</span>
      <b>Kim</b>
      <span>Adam</span>
      <b>Rafael</b>
      <span>Oleg</span>
    </div>
    <div>
      <b>Dave</b>
      <span>Ann</span>
    </div>
    <div>
      <i><span>Maurice</span></i>
      <span>Richard</span>
      <span>Ralph</span>
      <span>Jason</span>
    </div>

    <script src="/library/jquery.min.js"></script>
    <script src="/common/common.js"></script>
    <script>
      /*
      查找所有 span，筛选出是其兄弟 span 中的第2个元素
      [
        <span>Adam</span>,
        <span>Ralph</span>,
      ]
      */
      console.log(1, $('span:nth-of-type(2)'))

      /*
      查找所有 span，筛选出是其兄弟 span 中的倒数第2个元素
      [
        <span>Adam</span>,
        <span>Ralph</span>,
      ]
      */
      console.log(1, $('span:nth-last-of-type(2)'))
    </script>
  </body>
</html>
